package com.caac.core.web.action.common;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.caac.core.dm.User;
import com.caac.core.web.action.BaseAction;
import com.caac.core.web.form.BaseForm;

import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 * <p>
 * Title:
 * </p>
 * <p>
 * Description:
 * </p>
 * <p>
 * Copyright: Copyright (c) AgileCentury 2005
 * </p>
 * <p>
 * Company: AgileCentury
 * </p>
 * 
 * @author <a href="mailto:project@agilecentury.com">Project Group</a>
 * @version 1.0
 */

public class ShowMenuAction extends BaseAction {
	protected ActionForward doExecute(ActionMapping mapping, BaseForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		User user = this.getUserFromCache(request, response);
		if (user != null) {
			List menus = this.getUserManager().getMenusByUsername(
					user.getUsername());

			request.setAttribute("menuTree", menus);
		}

		return this.forward(mapping);
	}
}
